---
name: useUpdateEffect
route: /useUpdateEffect
menu: 'LifeCycle'
edit: false
sidebar: true
---
import JackBox from 'jackbox';

import Demo1 from './demo/demo1';
import Demo1CodeTsx from '!raw-loader!./demo/demo1.tsx';
import Demo1CodeJsx from '!raw-loader!./demo/demo1.jsx';

# useUpdateEffect

A hook of useEffect that only runs when dependencies update.

## Examples

### Basic usage
<JackBox jsCode={Demo1CodeJsx} tsCode={Demo1CodeTsx} demoName='Basic usage' description='This hook is exactly the same as useEffect, except it omits the first render and only runs when dependencies update.'>
  <Demo1 />
</JackBox>

## API

```javascript
useUpdateEffect(
  effect: () => (void | (() => void | undefined)),
  deps?: deps,
)
```

### Params

| Property | Description                                                        | Type                   | Default |
|---------|----------------------------------------------|------------------------|--------|
| effect | Executable function  | () => (void | (() => void | undefined)) | -      |
| deps | Optionally, pass in objects that depend on changes | array \| undefined | -      |